package com.vint.leetcode;


import java.util.Arrays;

/*
 * 1.easy
 *
 */
public class Leetcode561 {
    public int arrayPairSum(int[] nums) {
        Arrays.sort(nums);
        int result = 0;
        for (int i = 0; i < nums.length; i += 2) {
            result += nums[i];
        }
        return result;

    }

    public static void main(String[] args) {
        Leetcode561 leetcode561 = new Leetcode561();
        System.out.println(leetcode561.arrayPairSum(new int[]{1,4,3,2}));
    }
  }
